package com.example.springcloudgateway2demo.controller;

import com.example.springcloudgateway2demo.config.Result;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

@RestController
public class FallbackController {

    @GetMapping("/defaultFallback")
    public Mono<ResponseEntity<Result<Boolean>>> defaultFallback() {
        Result<Boolean> result = new Result<Boolean>().invokeFail(HttpStatus.INTERNAL_SERVER_ERROR.value(),
                HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase());
        return Mono.just(new ResponseEntity<>(result, HttpStatus.INTERNAL_SERVER_ERROR));
    }
}
